package cn.com.citydo.base.config;

import cn.com.citydo.base.intercepter.ResponseResultIntercepter;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * Create By Cuixk
 * 2019/7/3 11:36
 */
@Configuration
public class WebConfigurer implements WebMvcConfigurer {

    @Resource
    private ResponseResultIntercepter responseResultIntercepter;

    /**
     * 统一包装返回值拦截器 注册进MVC
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(responseResultIntercepter);
    }
}
